<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/16
 * Time: 13:16
 * used to study queue
 */

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Queue;
use App\Jobs\SendReminderEmail;
use Laravel\Lumen\Routing\Controller as BaseController;

class JobController extends BaseController
{
    public function addQueue(Request $request){
//        $this->validate($request,[
//            'email' => "required|email"
//        ]);
        for($i=0;$i<10000;$i++){
            $email = "497134".mt_rand(10,99)."@qq.com";
            $job = (new SendReminderEmail($email))->onQueue('writeFile');
            Queue::push($job);
//            $job = (new SendReminderEmail($email))->onQueue('writeFile');
//            $this->dispatch($job);
        }

    }
}